import webinfo from './webinfo'
export default {
	mixins: [webinfo],
	data() {
		return {}
	},
	computed: {
		//头像
		headImg() {
			return function(v) {
				return v.sysAttachment ? v.sysAttachment.httpUrl : this.headPic
			}
		},
		//书籍封面图
		coverJournalImg() {
			return function(v) {
				if (!v) return
				if (v.hasOwnProperty('httpUrl')) {
					return v.httpUrl
				} else if (v.sysAttachment) {
					return v.sysAttachment.httpUrl
				} else {
					return this.bookImg
				}
			}
		},
		//文章封面图
		coverImg() {
			return function(v) {
				if (v.fileId) {
					return v.sysAttachment.httpUrl
				} else {
					return this.articleImg
				}
			}
		},
		//首页视频封面图
		coverJournalImgWT() {
			return function(v) {
				if (!v) return
				if (v.coverPicture) {
					return v.coverPicture
				} else {
					return this.articleImg
				}
			}
		},
		//单位名称
		deptName() {
			return function(v) {
				return v.tbSysDept ? v.tbSysDept.name : ''
			}
		},
		//单位名称
		knowledge() {
			return function(v) {
				return v.sysIdeologicalEducation ? v.sysIdeologicalEducation.name : ''
			}
		},
	},
	methods: {
		getNames(v) {
			let { sourceUnit, tbSysDept } = v
			let deptNames = this.foo(tbSysDept, sourceUnit)
			return deptNames.substr(1, deptNames.length - 2)
		},
		foo(data) {
			return data.deptFullnamepath
		},
	},
}